package org.ht.service.impl;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.ht.dao.InvestInfoDao;
import org.ht.pojo.InvestInfo;
import org.ht.service.InvestService;
import org.springframework.stereotype.Service;

@Service
public class InvestServiceImpl implements InvestService {

	@Resource
	private InvestInfoDao investInfoDao;

	public int investA(InvestInfo ii) {

		return investInfoDao.create(ii);
	}

	public List<InvestInfo> investS(Map<String, Object> map) {

		return investInfoDao.recordList(map);
	}

	@Override
	public List<InvestInfo> getDtail(Map<String, InvestInfo> map) {
		return investInfoDao.getDtail(map);
		/**
		 * select * FROM investinfo where brrowid=#{params.brrowid}
		 */
	}

	@Override
	public Double sumMoney(Map<String, Object> map) {
		return investInfoDao.getSum(map);  
		/**
		 * select sum(${rowName}) from ${tableName} where 1 = 1
			<if test="uid != null">
				and userid = #{uid}	
			</if>
			<if test="bid != null">
				and brrowid = #{bid}
			</if>
		 */
	}

	@Override
	public Integer getMoney(Integer uid) {
		return investInfoDao.getMoney(uid);
	}

}
